<?php
/*
 * @Author: your name
 * @Date: 2019-11-01 14:17:13
 * @LastEditTime: 2020-12-11 10:34:29
 * @LastEditors: Please set LastEditors
 * @Description: 主机防火墙访问配置
 * @FilePath: /ahsmp_3/application/common/service/HostAccessLogConfig.php
 */

namespace app\common\service\module_manage\netfilter;


use think\Db;

class HostAccessLogConfig
{
    /**
     * @name: 添加
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2019-10-29 14:01:50
     */
    public function add ($host_id)
    {
        if(Db::name('HostAccessLogConfig')->where('host_id', $host_id)->count() > 0)
        {
            return [];
        }

        Db::name('HostAccessLogConfig')->insert(['host_id' => $host_id]);
    }

    /**
     * @name: 删除
     * @Param: 
     * @Description: 
     * @Author: foo
     * @Date: 2019-12-24 11:27:28
     */
    public function del ($host_id_a)
    {
        Db::name('HostAccessLogConfig')->whereIn('host_id', $host_id_a)->delete();
    }

    /**
     * @name 查询
     * @param $condition
     * @return array|null|\PDOStatement|string|\think\Model
     * @author wx
     * @date 2019/11/1 10:42
     */
    public function findData($condition)
    {
        return Db::name('host_access_log_config')->where($condition)->find();
    }

    /***
     * @name 修改
     * @param $condition
     * @param $updateData
     * @return int|string
     * @author wx
     * @date time
     */
    public function modify($condition, $updateData)
    {
        return Db::name('host_access_log_config')->where($condition)->update($updateData);
    }
}